<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>Modifier un employé</title>
            </f:facet>
        </h:head> 

        <h:body>
            <ui:composition template="./template.xhtml">
                <ui:define name="top">

                </ui:define>
                <ui:define name="left">
                    <h:form >
                       
                        <p:menu my="true" style="width:200px">
                            <p:submenu label="Navigation Employé" >  
                                <p:menuitem value="Les employés" action="#{redirectionBean.getRedirectionListeAmploye}" icon="ui-icon-home"
                                            styleClass="#{view.viewId == '/listeTravailleur.xhtml' || 
                                                          view.viewId == '/ajouterUnTravailleur.xhtml' || 
                                                          view.viewId == '/detailTravailleur.xhtml' ||
                                                          view.viewId == '/editerUnTravailleur.xhtml' ? 'ui-state-active' : ''}"
                                            />  
                                <p:menuitem value="Reporting" action="#" icon="ui-icon-star"/>  
                            </p:submenu>
                            <p:submenu label="Navigation Mission">  
                                <p:menuitem value="Gestion des missions" action="#{redirectionBean.getRedirectionGestionMission}" icon="ui-icon-suitcase" 
                                            styleClass="#{view.viewId == '/gestionMission.xhtml' ? 'ui-state-active' : ''}"
                                            />   
                            </p:submenu>  
                            <p:submenu label="Navigation Réglage">  
                                <p:menuitem value="Réglage formulaire" action="#{redirectionBean.getRedirectionGeglageformulaire}" icon="ui-icon-gear"
                                            styleClass="#{view.viewId == '/reglageformulaire.xhtml' ? 'ui-state-active' : ''}"
                                            />  
                            </p:submenu>  
                        </p:menu> 
                     
                    </h:form>
                </ui:define>
                <ui:define name="content">
                    <h:form id="formMessage"> 
                        <p:growl id="messageGrow" /> 
                        <p:growl id="messageGrowDetail" showDetail="true" />

                    </h:form>

                    <h:form id="formEditerTravailleur">
                        <p:panel header="Employé" style="width: 95%">
                            <f:facet name="header">
                                Editer, modifier et ajouter des informations sur un employé
                                <p:commandButton style="float: right; color: red;" value="Retour" title="Retour à la liste des employés" 
                                                 action="#{lesTravailleursBean.retourDansListe}"
                                                 immediate="true"
                                                 icon="ui-icon-arrowreturnthick-1-w"/>
                                <p:commandButton icon="ui-icon-disk" value="Enregistrer les modifications" 
                                                 action="#{lesTravailleursBean.enregistrerLesModification}"
                                                 update=":formMessage:messageGrowDetail, @form"
                                                 immediate="true"
                                                 style="color: green; float: right;"/>
                            </f:facet>

                            <div class="alert alert-danger"><strong>* Cliquer</strong> sur les zones en <strong>rouge</strong> pour les modifier!</div>

                            <p:accordionPanel multiple="true" id="DetailsTravailleur" >  
                                <p:tab title="Informations de personnelles" >
                                    <h:panelGrid columns="2" cellpadding="10">

                                        <h:panelGrid columns="1" cellpadding="5">
                                            <p:graphicImage id="PhotoDeProfil" value="#{lesTravailleursBean.cvTravailleurEdition.afficherImageEnBlob}" width="150" height="150" /> 
                                            <p:fileUpload id="Choisirunephoto" styleClass="taillerChargeurPhotoDeProfile" label="Choisir la photo"  fileUploadListener="#{lesTravailleursBean.handleFileUploadProfile}" 
                                                          update=":formMessage:messageGrow, PhotoDeProfil" 
                                                          mode="advanced"  
                                                          dragDropSupport="false" 
                                                          sizeLimit="1000000"  
                                                          allowTypes="/(\.|\/)(gif|jpe?g|png)$/" 
                                                          showButtons="false" /> 
                                        </h:panelGrid> 
                                        <h:panelGrid columns="1" cellpadding="5">
                                            <h:panelGrid columns="2">
                                                <p:panelGrid columns="2">
                                                    <p:outputLabel value="Matricule :" for="matricule"/>
                                                    <h:outputText value="#{lesTravailleursBean.cvTravailleurEdition.IDpersonne}" id="matricule"/>
                                                    <p:outputLabel value="Nom :" for="nom"/>
                                                    <p:inplace id="nom" editor="true" style="color: tomato;" effectSpeed="fast">  
                                                        <p:inputText value="#{lesTravailleursBean.cvTravailleurEdition.nom}" style="width: 70px;" 
                                                                     required="true" label="text"/>  
                                                    </p:inplace>  

                                                    <p:outputLabel value="Prenom :" for="prenom"/>
                                                    <p:inplace id="prenom" editor="true" style="color: tomato;" effectSpeed="fast"> 
                                                        <p:inputText required="true" style="width: 70px;"
                                                                     value="#{lesTravailleursBean.cvTravailleurEdition.prenom}" label="text"/>
                                                    </p:inplace>
                                                    <p:outputLabel value="Date de naissance :" for="naissance"/>
                                                    <p:inplace id="naissance" editor="true" style="color: tomato;" label="#{lesTravailleursBean.cvTravailleurEdition.datenaissanceFormatee}" effectSpeed="fast"  >  
                                                        <p:calendar  value="#{lesTravailleursBean.cvTravailleurEdition.datenaissance}"  pattern="dd/MM/yyyy"
                                                                     navigator="true"  maxdate="#{travailleurBean.dateDuJour}" 
                                                                     title="La date de naissance" required="true">
                                                             <f:convertDateTime pattern="dd/MM/yyyy" />
                                                        </p:calendar>

                                                    </p:inplace> 
                                                    <p:outputLabel value="Nationnalités : " for="listeNationnalite" />  
                                                    <p:dataList id="listeNationnalite" value="#{lesTravailleursBean.cvNationalitetravailleurSelectionner}" var="nationalite">  
                                                        <p:graphicImage value="./public/images/drapeau/#{nationalite.cvPays.codePays}.png" width="16" height="11"/> #{nationalite.cvPays.paysfr} <br /> 
                                                    </p:dataList>
                                                </p:panelGrid>
                                                <p:panelGrid columns="1">
                                                    <h:outputLabel value="Adresse complète" for="AdresseComplete"/>
                                                    <p:panelGrid columns="2" id="AdresseComplete">
                                                        <p:outputLabel value="Adresse :" for="adresse"/>
                                                        <p:inplace id="adresse" editor="true" style="color: tomato;" effectSpeed="fast"  > 
                                                            <p:inputText value="#{lesTravailleursBean.elementAdresse.adresse}" required="true" label="text" />
                                                        </p:inplace>
                                                        <p:outputLabel value="Code postale :" for="codePostal"/>
                                                        <p:inplace id="codePostal" editor="true" style="color: tomato;" emptyLabel="Cliquer pour editer" effectSpeed="fast">
                                                            <p:inputMask  mask="99?9999" style="width: 80px;" value="#{lesTravailleursBean.elementAdresse.codePostal}" />
                                                        </p:inplace>
                                                        <p:outputLabel value="Pays :" for="pays"/>
                                                        <p:inplace id="pays" editor="true" style="color: tomato;" label="#{lesTravailleursBean.elementAdresse.pays}" effectSpeed="fast" > 
                                                            <p:selectOneMenu 
                                                                style="width:100px" 
                                                                converter="paysConverter"
                                                                requiredMessage="Pays de residence :
                                                                erreur de validation. Vous devez indiquer une valeur."
                                                                filter="true"
                                                                value="#{lesTravailleursBean.elementAdresse.cvPays}" var="p" required="true" >  
                                                                <f:selectItem itemLabel="Selectionner un pays" itemValue=""  />  
                                                                <f:selectItems value="#{travailleurBean.listePays}" var="pays" 
                                                                               itemLabel="#{pays.paysfr}" itemValue="#{pays}" /> 
                                                                <p:column>  
                                                                    <p:graphicImage value="./public/images/drapeau/#{p.codePays}.png" width="16" height="11"/>  
                                                                </p:column>  
                                                                <p:column>  
                                                                    #{p.paysfr} 
                                                                </p:column>
                                                            </p:selectOneMenu>
                                                        </p:inplace>

                                                    </p:panelGrid>

                                                </p:panelGrid>
                                            </h:panelGrid>
                                            <h:panelGrid columns="2">
                                                <p:panelGrid columns="2">
                                                    <p:outputLabel value="Poste :" for="poste"/>
                                                    <h:outputText value="#{lesTravailleursBean.cvPosteoccupeSelectionner.cvListeposteIdposte.poste}" id="poste"/>
                                                    <p:outputLabel value="Equipe :" for="equipe"/>
                                                    <h:outputText value="#{lesTravailleursBean.cvAffectationSelectionner.cvEquipedepartementIdequipedepartement.equipe}" id="equipe"/>
                                                    <p:outputLabel value="Département :" for="departement"/>
                                                    <h:outputText value="#{lesTravailleursBean.cvAffectationSelectionner.cvEquipedepartementIdequipedepartement.iddepartement.nomdepartement}" id="departement"/>
                                                    <p:outputLabel value="Mission :" for="mission"/>
                                                    <h:outputText value="#{lesTravailleursBean.cvAffectationSelectionner.cvEquipedepartementIdequipedepartement.iddepartement.idmission.idmission}" id="mission"/>
                                                </p:panelGrid>
                                                <p:panelGrid columns="1">
                                                    <p:outputLabel value="Téléphone :" for="listeTelephone"/>
                                                    <p:dataList id="listeTelephone" value="#{lesTravailleursBean.listeCvTelephonetavaleursSelectionner}" var="telephone">  
                                                        <p:inplace id="adresse" editor="true" style="color: tomato;" effectSpeed="fast" emptyLabel="Cliquer pour editer"  > 
                                                            <p:inputText styleClass="alert-info" value="#{telephone.numerotelephone}" 
                                                                         validator="#{lesTravailleursBean.validerUnNumeroDesTelephone}"/>
                                                        </p:inplace>

                                                    </p:dataList>
                                                </p:panelGrid>
                                            </h:panelGrid>

                                        </h:panelGrid>
                                    </h:panelGrid>  
                                </p:tab>  
                                <p:tab title="Documents personnelles" titleStyle="color: #F00;">  
                                    <h:panelGrid columns="1" cellpadding="10">
                                        <h:panelGrid columns="2" cellpadding="10">
                                            <p:panel header="Pièce d'identité">
                                                <h:panelGrid columns="2">
                                                    <p:outputLabel value="N°numéro de pièce :" for="pieceidentite"/>
                                                    <p:inplace id="pieceidentite" editor="true" style="color: tomato;" emptyLabel="Cliquez pour editer" effectSpeed="fast"  >  
                                                        <p:inputText value="#{lesTravailleursBean.cvDocofficiels.numerocardeidentite}" 
                                                                     required="true" label="text" />  
                                                    </p:inplace>
                                                    <p:outputLabel value="Justificatif de la pièce :" for="justificatifPiece" />
                                                    <h:commandLink value="#" id="justificatifPiece" /> 
                                                    
                                                </h:panelGrid>
                                            </p:panel>
                                            <p:panel header="Visa">
                                                <h:panelGrid columns="2">
                                                    <p:outputLabel value="N°numéro du visa :" for="visanumber"/>
                                                    <p:inplace id="visanumber" editor="true" style="color: tomato;" emptyLabel="Cliquez pour editer" effectSpeed="fast" > 
                                                        <p:inputText value="#{lesTravailleursBean.cvDocofficiels.numerovisa}"  label="text" /> 
                                                    </p:inplace>
                                                    <p:outputLabel value="Justificatif du visa :" for="justificatifVisa"  />
                                                    <h:commandLink value="#" id="justificatifVisa" /> 
                                                </h:panelGrid>
                                            </p:panel>
                                        </h:panelGrid>
                                        <h:panelGrid columns="2" cellpadding="10">
                                            <p:panel header="Passeports" >
                                                <h:panelGrid columns="2">
                                                    <p:outputLabel value="Numéro des passeports : " for="listePasseport" />  
                                                    <p:dataList id="listePasseport" value="#{lesTravailleursBean.cvNationalitetravailleurSelectionner}" var="nationalite">  
                                                        <p:inplace  editor="true" style="color: tomato;" emptyLabel="Cliquez pour editer" effectSpeed="fast"   > 
                                                            <p:inputText style="width: 80px;" value="#{nationalite.numeropasseport}"/> 
                                                        </p:inplace>
                                                        |
                                                        <p:graphicImage value="./public/images/drapeau/#{nationalite.cvPays.codePays}.png" width="16" height="11"/> #{nationalite.cvPays.paysfr} <br /> 
                                                    </p:dataList>
                                                    <p:outputLabel value="Justificatif des passeports : " for="listeJustificatiPassepot" />  
                                                    <p:dataList id="listeJustificatiPassepot" value="#{lesTravailleursBean.cvNationalitetravailleurSelectionner}" var="nationalite">  
                                                        <h:commandLink value="#{nationalite.scanpasseport}" rendered="#{nationalite.scanpasseport != null}" /> <br /> 
                                                    </p:dataList>
                                                </h:panelGrid>
                                            </p:panel>
                                            <p:panel header="Permis de conduire" >
                                                <h:panelGrid columns="2">
                                                    <p:outputLabel value="N°numéro du permis :" for="permisNum"/>
                                                    <p:inplace id="permisNum"  editor="true" style="color: tomato;" emptyLabel="Cliquez pour editer" effectSpeed="fast"  > 
                                                        <p:inputText style="width: 90px;" value="#{lesTravailleursBean.cvPermisconduireSelectionner.numeropermis}" />
                                                    </p:inplace>
                                                    <p:outputLabel value="Type de permis:" for="typePermis"/>
                                                    <p:inplace  id="typePermis"  editor="true" style="color: tomato;" effectSpeed="fast" emptyLabel="Cliquez pour editer" label="#{lesTravailleursBean.cvPermisconduireSelectionner.typepermis}" > 
                                                        <p:selectManyCheckbox value="#{lesTravailleursBean.typePermis}">  
                                                            <f:selectItem itemLabel="A" itemValue="A" />  
                                                            <f:selectItem itemLabel="B" itemValue="B" />  
                                                            <f:selectItem itemLabel="C" itemValue="C" />  
                                                            <f:selectItem itemLabel="D" itemValue="D" />  
                                                            <f:selectItem itemLabel="E" itemValue="E" />  
                                                        </p:selectManyCheckbox>
                                                    </p:inplace>
                                                    <p:outputLabel value="Fin de valider:" for="validitePermis"/>
                                                    <h:outputText value="#{lesTravailleursBean.cvPermisconduireSelectionner.dateexpirationpermis}" id="validitePermis">
                                                        <f:convertDateTime pattern="dd/MM/yyyy" />
                                                    </h:outputText>
                                                    <p:outputLabel value="Justificatif du permis :" for="justificatifPermis"  />
                                                    <h:commandLink value="#" id="justificatifPermis" /> 
                                                </h:panelGrid>
                                            </p:panel>
                                        </h:panelGrid>  
                                    </h:panelGrid>
                                </p:tab>  
                                <p:tab title="Contrat et Affectation">  
                                    <h:panelGrid columns="2" cellpadding="10">
                                        <p:panel header="Contrat">
                                            <h:panelGrid columns="2">  
                                                <p:outputLabel value="Compagnie :" for="compagnie"/>
                                                <p:inplace id="compagnie"  editor="true" style="color: tomato;" emptyLabel="Cliquez pour editer" label="#{lesTravailleursBean.cvTravailleurEdition.cvTravail.idcompagnie.nomcompagnie}" >
                                                    <p:selectOneMenu   
                                                        style="width:150px" 
                                                        value="#{lesTravailleursBean.cvTravailleurEdition.cvTravail.idcompagnie}" converter="compagnieConverter"
                                                        required="true" filter="true" >   
                                                        <f:selectItems value="#{travailleurBean.listeCompagnie}" var="compagnie" itemLabel="#{compagnie.nomcompagnie}" itemValue="#{compagnie}"/>  

                                                    </p:selectOneMenu> 
                                                </p:inplace>


                                                <p:outputLabel value="Type de contrat :" for="typeContrat"/>
                                                <p:inplace id="typeContrat"  editor="true" style="color: tomato;" emptyLabel="Cliquez pour editer" label="#{lesTravailleursBean.cvTravailleurEdition.cvTravail.typecontrat.typecontrat}" >
                                                    <p:selectOneMenu  
                                                        style="width:150px"
                                                        value="#{lesTravailleursBean.cvTravailleurEdition.cvTravail.typecontrat}" converter="typedecontratConverter"
                                                        required="true"  filter="true">  
                                                        <f:selectItems value="#{travailleurBean.listeTypeContrat}" var="typedecontrat" itemLabel="#{typedecontrat.typecontrat}" itemValue="#{typedecontrat}"/>  

                                                    </p:selectOneMenu>
                                                </p:inplace>

                                                <p:outputLabel value="Date de debut :" for="datedebut"/>
                                                <h:outputText id="datedebut" value="#{lesTravailleursBean.cvTravailleurEdition.cvTravail.debutcontrat}" >
                                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                                </h:outputText>

                                                <p:outputLabel value="Date de fin :" for="datefin"/>
                                                <h:outputText id="datefin" value="#{lesTravailleursBean.cvTravailleurEdition.cvTravail.fincontrat}" >
                                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                                </h:outputText>
                                                <p:outputLabel value="Statue :" for="statut"/>
                                                <h:outputText value="#{lesTravailleursBean.statuEmpleye}" id="statut" />
                                            </h:panelGrid> 
                                        </p:panel>
                                        <p:panel>
                                            <f:facet name="header">
                                                Affectation et Poste
                                                <p:commandButton id="changerPoste" value="P" style="float: right;"  icon="ui-icon-plus"
                                                                 update=":formDialogEditer2:formchangementPostDialog"
                                                                 immediate="true"
                                                                 oncomplete="changementPostDialog.show()"
                                                                 />
                                                <p:tooltip for="changerPoste" value="Changer le poste de l'employé" 
                                                           showEffect="clip" hideEffect="explode"/> 
                                                <p:commandButton id="changerAffectation" value="A" style="float: right;"  icon="ui-icon-plus" 
                                                                 update=":formDialogEditer:formChangementAffectationDialog"
                                                                 immediate="true"
                                                                 oncomplete="changementAffectationDialog.show()"
                                                                 />
                                                <p:tooltip for="changerAffectation" value="Changer l'affectation de l'employé" 
                                                           showEffect="clip" hideEffect="explode"/>  

                                            </f:facet>
                                            <h:panelGrid columns="2">
                                                <p:outputLabel value="Poste :" for="posteAffectation"/>
                                                <h:outputText value="#{lesTravailleursBean.cvPosteoccupeSelectionner.cvListeposteIdposte.poste}" id="posteAffectation"/>
                                                <p:outputLabel value="Equipe :" for="equipeAffectation"/>
                                                <h:outputText value="#{lesTravailleursBean.cvAffectationSelectionner.cvEquipedepartementIdequipedepartement.equipe}" id="equipeAffectation"/>
                                                <p:outputLabel value="Département :" for="departementAffectation"/>
                                                <h:outputText value="#{lesTravailleursBean.cvAffectationSelectionner.cvEquipedepartementIdequipedepartement.iddepartement.nomdepartement}" id="departementAffectation"/>
                                                <p:outputLabel value="Mission :" for="missionAffectation"/>
                                                <h:outputText value="#{lesTravailleursBean.cvAffectationSelectionner.cvEquipedepartementIdequipedepartement.iddepartement.idmission.idmission}" id="missionAffectation"/>
                                                <p:outputLabel value="Date d'affectation :" for="dateAffactationInfos" />
                                                <h:outputText id="dateAffactationInfos" value="#{lesTravailleursBean.cvAffectationSelectionner.dateaffectation}" >
                                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                                </h:outputText>
                                            </h:panelGrid>
                                        </p:panel> 
                                        <p:panel>
                                            <f:facet name="header">
                                                Historique des changement de poste et d'affectation
                                            </f:facet>
                                            <h:panelGrid columns="1">
                                                <p:panelGrid columns="2">
                                                    
                                                </p:panelGrid>
                                                <p:panelGrid columns="2">
                                                    
                                                </p:panelGrid>
                                            </h:panelGrid>
                                        </p:panel>
                                    </h:panelGrid>  

                                </p:tab>  
                                <p:tab title="Aptitude médicale">  
                                    <h:panelGrid columns="2" cellpadding="10" rendered="false">  
                                        <p:graphicImage value="/images/godfather/godfather3.jpg" />  
                                        <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.   
                                                      Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." />  
                                    </h:panelGrid>  
                                </p:tab>  
                                <p:tab title="Aptitude professionnelle">  
                                    <h:panelGrid columns="2" cellpadding="10" rendered="false">  
                                        <p:graphicImage value="/images/godfather/godfather3.jpg" />  
                                        <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.   
                                                      Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." />  
                                    </h:panelGrid>  
                                </p:tab>  
                                <p:tab title="Formations">  
                                    <h:panelGrid columns="2" cellpadding="10" rendered="false">  
                                        <p:graphicImage value="/images/godfather/godfather3.jpg" />  
                                        <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.   
                                                      Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." />  
                                    </h:panelGrid>  
                                </p:tab>  
                                <p:tab title="Comportements">  
                                    <h:panelGrid columns="2" cellpadding="10" rendered="false">  
                                        <p:graphicImage value="/images/godfather/godfather3.jpg" />  
                                        <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.   
                                                      Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate." />  
                                    </h:panelGrid>  
                                </p:tab>  
                            </p:accordionPanel> 


                        </p:panel>
                    </h:form>

                    <h:form id="formDialogEditer">
                        <p:dialog header="Changement de l'affectation" widgetVar="changementAffectationDialog" resizable="false" id="changementAffectationDialogId"  
                                  hideEffect="explode" showEffect="slide" >  
                            <h:form id="formChangementAffectationDialog">
                                <p:panelGrid columns="2" >
                                    <p:outputLabel value="Mission :" for="mission" />
                                    <p:selectOneMenu id="mission" style="width:200px" required="true" value="#{travailleurBean.cvMission}" converter="missionConverter">  
                                        <f:selectItem itemLabel="Selectionne mission" itemValue="" />  
                                        <f:selectItems value="#{travailleurBean.listeMission}" var="mission" itemLabel="#{mission.idmission}" itemValue="#{mission}"/>  
                                        <p:ajax update="departement, equipe" 
                                                listener="#{travailleurBean.handleMissionChange}" />  
                                    </p:selectOneMenu>  

                                    <p:outputLabel value="Departement :" for="departement" />
                                    <p:selectOneMenu id="departement" style="width:200px" required="true" value="#{travailleurBean.cvListedepartement}" converter="departementConverter">  
                                        <f:selectItem itemLabel="Selectionner departement" itemValue="" />  
                                        <f:selectItems value="#{travailleurBean.departementListeHand}" var="departement" itemLabel="#{departement.nomdepartement}" itemValue="#{departement}" />  
                                        <p:ajax update="equipe" 
                                                listener="#{travailleurBean.handleDepartementChange}" />
                                    </p:selectOneMenu> 

                                    <p:outputLabel value="Equipe :" for="equipe" />
                                    <p:selectOneMenu id="equipe" style="width:200px" required="true" value="#{travailleurBean.cvEquipedepartement}" converter="equipeConverter">  
                                        <f:selectItem itemLabel="Selectionner departement" itemValue="" />  
                                        <f:selectItems value="#{travailleurBean.equipeListeHand}" var="equipe" itemLabel="#{equipe.equipe}" itemValue="#{equipe}" />  
                                    </p:selectOneMenu> 

                                    <p:outputLabel value="Date d'affectation :" for="dateAffactation" />
                                    <p:calendar id="dateAffactation" value="#{travailleurBean.dateAffectation}"
                                                mindate="#{lesTravailleursBean.cvAffectationSelectionner.dateaffectation}"
                                                pattern="dd/MM/yyyy " title="Date d'affectation" required="true" 
                                                />
                                    <h:outputText />
                                    <p:commandButton value="Valider l'affectation" icon="ui-icon-check"
                                                     action="#{lesTravailleursBean.nouvelleAffection}"
                                                     update=":formDialogEditer:formChangementAffectationDialog, :formMessage:messageGrow"
                                                     oncomplete="handleCreerNouvelleAffectationRequest(xhr, status, args)"
                                                     >
                                        <f:setPropertyActionListener value="#{travailleurBean.cvEquipedepartement}" target="#{lesTravailleursBean.cvAffectationNouveau.cvEquipedepartementIdequipedepartement}"/>
                                        <f:setPropertyActionListener value="#{travailleurBean.dateAffectation}" target="#{lesTravailleursBean.cvAffectationNouveau.dateaffectation}"/>
                                    </p:commandButton>
                                </p:panelGrid>   
                            </h:form>
                        </p:dialog>
                    </h:form >
                    <h:form id="formDialogEditer2">
                        <p:dialog header="Changement de le poste" widgetVar="changementPostDialog" resizable="false" id="changementPostDialogId"  
                                  hideEffect="explode" showEffect="slide" >  
                            <h:form id="formchangementPostDialog">
                                <p:panelGrid columns="2">
                                    <p:outputLabel value="Poste :" for="posteselectionner" />
                                    <p:selectOneMenu  id="posteselectionner"
                                                      style="width:200px"
                                                      value="#{travailleurBean.cvListeposte}" converter="listeposteConverter"
                                                      required="true"  filter="true">   
                                        <f:selectItem itemLabel="Selectionner le poste" itemValue="" /> 
                                        <f:selectItems value="#{travailleurBean.listePoste}" var="poste" itemLabel="#{poste.poste}" itemValue="#{poste}"/>  

                                    </p:selectOneMenu>
                                    <h:outputText/>
                                    <p:commandButton value="Valider l'affectation" icon="ui-icon-check"
                                                     action="#{lesTravailleursBean.nouveauPoste}"
                                                     update=":formDialogEditer2:formchangementPostDialog, :formMessage:messageGrow"
                                                     oncomplete="handleCreerNouvellePostRequest(xhr, status, args)"
                                                     >
                                        <f:setPropertyActionListener value="#{travailleurBean.cvListeposte}" target="#{lesTravailleursBean.cvPosteoccupeNouveau.cvListeposteIdposte}"/>
                                    </p:commandButton>
                                </p:panelGrid>
                            </h:form>
                        </p:dialog>
                    </h:form>
                    <script type="text/javascript">
                        function handleCreerNouvelleAffectationRequest(xhr, status, args) {
                            if (args.validationFailed || !args.status) {
                                //alert(args.message);
                            } else {
                                changementAffectationDialog.hide();

                            }
                        }
                        function handleCreerNouvellePostRequest(xhr, status, args) {
                            if (args.validationFailed || !args.status) {
                                //alert(args.message);
                            } else {
                                changementPostDialog.hide();
                            }
                        }
                    </script>
                </ui:define>


            </ui:composition>
        </h:body>

    </f:view>
</html>

